#include <stdio.h>

int main()
{
	int i, num, guessNum;
	srand((unsigned)time(NULL));
	num = rand() % 50 + 1;

	for (i = 1; i <= 10; i++)
	{
		printf_s("请输入第%d次猜测数：", i);
		scanf("%i", &guessNum);
		if (guessNum > num)
		{
			printf_s("Your answer is HIGH, try again\n");
		}
		else if (guessNum < num)
		{
			printf_s("Your answer is LOW, try again\n");
		}
		else
		{
			break;
		}
	}

	if (i == 11)
	{
		printf_s("您没有猜测对，%d次机会已用完\n", --i);
	}
	else
	{
		printf_s("恭喜您猜对了，共猜测了%d次\n", i);
	}

	system("pause");
	return 0;
}